<?php
namespace Home\Controller;
use Think\Controller;
use Think\Hook;

/**
 * 豆信首页控制器
 * @author 艾逗笔<765532665@qq.com>
 */
class IndexController extends Controller {

	/**
	 * 初始化
	 * @author 艾逗笔<765532665@qq.com>
	 */
	public function _initialize() {
		$system_settings = D('Admin/SystemSetting')->get_settings();
		$this->assign('system_settings', $system_settings);
	}
    
    /**
     * 首页
     * @author 佛祖<381361943@qq.com>
     */
    public function index() {
        //paging();die;
        //轮播图
        $picture = M('picture')->order('`order` asc')->limit(5)->select();
        $this->assign('picture',$picture);
        //热推产品
        $shop = M('shop as a')
            ->field("a.id,a.picture,a.title,b.name")
            ->join("dc_type as b on a.type = b.id")
            ->order("a.id desc")
            ->limit(6)
            ->select();
        $this->assign('shop',$shop);
        //热门资讯
        $new = M('new')->order('id desc')->limit(6)->select();
        $this->assign('new',$new);
    	$this->display();
    }

}